Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

151
Vistas
Getting error when executing a lambda function - Parameter \"userId\" has value with no field set

I guess I am making a silly coding mistake, but have been trying for more than a day. I am trying to insert records onto aurora table with the parameters received as a stream from dynamodb table.

I cant seem to set the parameters on the params object correctly. I want the sql statement and the parameters on the params object to be set outside params as the right statement depends on if it is an INSERT, MODIFY or REMOVE. Here is my code -

const AWS = require('aws-sdk');
var RDS = new AWS.RDSDataService();

exports.handler = async (event, context) => {
    var userId;
    var givenName;
    
    const params = {
        secretArn: 'secretArn',
        resourceArn: 'resourceArn',
        database: 'db',
        parameters: [{
                name: 'userId',
                value: {
                    "stringValue": this.userId
                }
            },
            {
                name: 'givenName',
                value: {
                    "stringValue": this.givenName
                }
            }
        ]
    };    
    let record = event['Records'];        
    if (record[0].eventName == 'INSERT') {
        params.sql = `INSERT INTO Users (UserId, GivenName) VALUES(userId, givenName);`
        userId = record[0].dynamodb.NewImage.pk.S;
        givenName = record[0].dynamodb.NewImage.sk.S;            
    }
    let result = await RDS.executeStatement(params).promise();
    return JSON.stringify(result);
};

Please advise!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Looking at examples in the documentation, you need to prefix the parameter placeholders with :. Like this:

 params.sql = `INSERT INTO Users (UserId, GivenName) VALUES(:userId, :givenName);`
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda